<!--info.less-->
<template>
	<section id="security">
		<HeaDer :Title='titleData'></HeaDer>
		<section class="securityWarp">
			<section class="title">
				<h2>安全中心</h2>
			</section>

			<ul class="lisWarp">
				<li class="list">
					<span class="title">手机</span>
					<span class="state">已绑定</span>
					<i class="van-icon van-icon-arrow"></i>
				</li>
				<li class="list" @click="goUrl('securityemail')">
					<span class="title">邮箱</span>
					<span class="state" v-if="!navData.email">绑定</span>
					<span class="state" v-else>{{navData.email}}</span>
					<i class="van-icon van-icon-arrow"></i>
				</li>
				<li class="list" @click="goUrl('securitypwd')">
					<span class="title">登录密码</span>
					<span class="state">重设</span>
					<i class="van-icon van-icon-arrow"></i>
				</li>
				<li class="list" @click="goUrl('securitytpwd')">
					<span class="title">支付密码</span>
					<span class="state" v-if="!navData.tpwd">设置</span>
					<span class="state" v-else>重设</span>
					<i class="van-icon van-icon-arrow"></i>
				</li>
				<li class="list" @click="goUrl('securityname')">
					<span class="title">实名认证</span>
					<span class="state" v-if="navData.name == '1'">未验证</span>
					<span class="state" v-if="navData.name == '2'">审核中</span>
					<span class="state" v-if="navData.name == '3'">已认证</span>
					<span class="state" v-if="navData.name == '4'">认证失败</span>
					<i class="van-icon van-icon-arrow"></i>
				</li>
			</ul>
		</section>
	</section>
</template>
<script>
	import HeaDer from "../common/header.vue";
	export default {
		data() {
			return {
				titleData: {
					name: '',
					flat: 1
				},
				navData: {
					mobile: false,
					email: false,
					tpwd: false,
					name: '1'
				}
			}
		},
		methods: {
			//路由跳转控制
			goUrl(urls) {
				var _this = this;
				switch(urls){
					case 'securityemail':
						if(_this.navData.email) return false;    //控制是否可以邮箱换帮
					break;
					case 'securityname':
					switch(_this.navData.name){
						case '2':
						_this.$toast('您的信息正在审核');
						return false;
						break;
						case '3':
						_this.$toast('您已认证通过');
						return false;
						break;
					}
					break;
					case 'securitytpwd':  //支付密码
					switch(_this.navData.name){
						case '1':
						_this.$toast('请先进行实名认证');
						return false;
						break;
						case '4':
						_this.$toast('请先进行实名认证');
						return false;
						break;
						
					}
				}
				_this.$public.go(urls, 0, _this);
			},
			//获取个人状态
			getUserInfo() {
				var _this = this;
				_this.$public.userInfo({
					_this: _this,
					mobile: sessionStorage.mobile,
					sfun: function(data) {
						if(data.data.status == 200) {
							_this.navData.email = data.data.data.mail == null?false:data.data.data.mail;   //邮箱判断
							_this.navData.tpwd = data.data.data.tpwd == null?false:true;   //支付密码判断
							_this.navData.name = data.data.data.status;  //认证状态判断
							
						}
					}
				})
			}
		},
		components: {
			'HeaDer': HeaDer

		},
		created: function() {
			this.getUserInfo();
		}
	}
</script>

<style>

</style>